namespace JQuery.WebKit
{
    using System.ComponentModel;
    using System.Security.Permissions;
    using System.Web;
    using System.Web.UI;

    [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
    public class WebGridEditFieldAttribute : BaseItem
    {
        private bool _isTracking;
        private StateBag _viewState = new StateBag();

        //void IStateManager.LoadViewState(object state)
        //{
        //    if (state != null)
        //    {
        //        ((IStateManager) this.ViewState).LoadViewState(state);
        //    }
        //}

        //object IStateManager.SaveViewState()
        //{
        //    return ((IStateManager) this.ViewState).SaveViewState();
        //}

        //void IStateManager.TrackViewState()
        //{
        //    this._isTracking = true;
        //    ((IStateManager) this.ViewState).TrackViewState();
        //}

        [Category("Behavior"), Description("The name of the HTML attribute"), DefaultValue(""), NotifyParentProperty(true)]
        public string Name
        {
            get
            {
                if (this.ViewState["Name"] != null)
                {
                    return (string) this.ViewState["Name"];
                }
                return "";
            }
            set
            {
                this.ViewState["Name"] = value;
            }
        }

        //bool IStateManager.IsTrackingViewState
        //{
        //    get
        //    {
        //        return this._isTracking;
        //    }
        //}

        [Description(""), DefaultValue(""), NotifyParentProperty(true), Category("Behavior")]
        public string Value
        {
            get
            {
                if (this.ViewState["Value"] != null)
                {
                    return (string) this.ViewState["Value"];
                }
                return "";
            }
            set
            {
                this.ViewState["Value"] = value;
            }
        }

        //private StateBag ViewState
        //{
        //    get
        //    {
        //        return this._viewState;
        //    }
        //}
    }
}

